package org.exercise9.mediator;

/**
 * @author Stranger
 * @version 1.0
 * @description: TODO
 * @date 2022/12/20 16:04
 */
public abstract class Person {
    protected String name;
    protected Mediator mediator;

    public Person(String name, Mediator mediator) {
        this.name = name;
        this.mediator = mediator;
    }

    public void contract(String message) {
        this.mediator.sendMessage(this.name + ":" + message);
    }

    public String getContract() {
        return this.mediator.message();
    }
}
